package thread;

public class Demo6 {
    public static void main(String[] args) {
        //无参构造 创建线程
        Thread thread1 = new Thread();
        //创建制定名称的线程
        Thread thread2 = new Thread("name");
        //传入 runnable接口
        Thread thread3 = new Thread(()->{
            while (true){
                System.out.println("hello thread");
            }
        });
        //传入runnable接口和线程名称
        Thread thread4 = new Thread(new Runnable() {
            @Override
            public void run() {
                while (true){
                    System.out.println("hello thread");
                }
            }
        },"name");
    }
}
